<?php
//=========================
//Vuong Van Binh
//Wanbin@vietnambiz.com
//list & del faq
//=========================
include ADMIN_INCLUDE_DIR."/header.php";
del_faq();
del_multi_faq();

$rs_faq = get_all_faq_page();

?>
<div class="container_l">
		<div class="title_user"><img src="images/icon1.gif" />All FAQs
		
			<span style="float:right; padding:2px; display:inline; margin-top:5px;">
			<select name="cat" id="cat" onchange="view_cat('<?php echo ADMIN_URL;?>');" style="height:28px; width:200px; font-size:11px; font-weight:bold; color:#375B91; text-transform:none">
			
			<?php
				      $rs = get_all_cat_faq();
					  
					  if($db->num_rows($rs) > 0){
					  
						while($cat_faq=$db->fetch_array($rs)){

						 if($cat_faq["cat_id"]==intval($_GET["cat"])){

							echo "<option value='".$cat_faq["cat_id"]."' selected='selected'>".$cat_faq["cat_name"]."</option>";
						
						  }else{
						  
						 	echo "<option value='".$cat_faq["cat_id"]."'>".$cat_faq["cat_name"]."</option>";
						  }
					    }
					}
			
			?>
			
			</select>
			</span>	
		
		</div>
		<div class="table_user">
			<form name="del_check" action="" method="post" id="form_del_check">
			<div class="table_user_in">
				<div class="boxtitle">
					<div class="d_input" style="width:3%;"><input type="checkbox" name="checkall" id="checkall" value="" /></div>
					<div class="d_user" style="width:43%; text-align:left">&nbsp;&nbsp;Title</div>
					<div class="d_fullname" style="width:40%;text-align:left">&nbsp;&nbsp;Category</div>
					<div class="d_setting" style="width:13%;">Setting</div>
				</div>
				
				<?php
					while($faq=$db->fetch_array($rs_faq["faq"])){	
				
				?>
				
						<div class="lineuser">
							<div class="d_input2" style="width:3%;"><input type="checkbox" name="check[]" id="check" class="check" value="<?php echo $faq["id"]; ?>" /></div>
							<div class="d_user2" style="width:43%;text-align:left"><font class="textbody"><a href="<?php echo ADMIN_URL; ?>/index.php?module=faq-preview&id=<?php echo $faq["id"]; ?>&keepThis=true&TB_iframe=true&height=450&width=500" class="thickbox" ><?php echo $faq["title"]; ?></a></font></div>
							<div class="d_fullname2" style="width:40%; text-transform:capitalize; text-align:left"><font class="textbody"><?php echo $faq["cat_name"]; ?></font></div>
							<div class="d_setting2" style="width:13%;">
							<a href="<?php echo ADMIN_URL; ?>/index.php?module=faq-preview&id=<?php echo $faq["id"]; ?>&keepThis=true&TB_iframe=true&height=450&width=500" class="thickbox" >
							<img src="images/profile.gif" alt="view" title="view" />
							</a>
							
							<a href="index.php?module=faq&action=edit&id=<?php echo $faq["id"]; ?>"><img src="images/edit.gif" alt="Edit" title="Edit" /></a>
							<a onclick="confirm_get('Are you sure to delete : <b><?php echo replace_quot($faq["title"]); ?></b> ?','<?php echo get_string_url(array('del'));?>&del=<?php echo $faq["id"]?>');" href="javascript:void(0);"><img src="images/delete.gif" alt="Delete" title="Delete" /></a></div>
						</div>
				
				<?php 		} ?>
				
				<div class="boxbutton">
				    <input type="hidden" name="del_multi" value="okie" />
 					<input type="button" value="Delete checked" class="button" onclick="confirm_post('Are you sure to delete all checked','form_del_check');" />
					<input type="button" name="delete" value="Cancel" class="button" id="cancel"/>
					&nbsp;<a href="index.php?module=faq&action=add"><img src="images/addnew.gif" border="0" /></a>
				</div>
				</form>
				<?php
				    // SHOW PAGING
				    if($rs_faq["total"]>1){ 
				    echo "<div class='lineinbox'>";
					echo paging($rs_faq["page"],$rs_faq["total"],get_string_url());
					echo "</div>";
					}
				?>
				
			</div>
		</div>
			
</div>
<script type="text/javascript">
	function view_cat(baseurl)
	{
	  var mode = document.getElementById('cat').value;
	 
	  window.location = baseurl+'/index.php?module=faq&cat='+mode;
	}
</script>
<?php
include "inc/right.php"; 
include ADMIN_INCLUDE_DIR."/footer.php"; 
?>